package com.tianbao54.thrift.impl;

import com.tianbao54.thrift.generated.User;
import com.tianbao54.thrift.generated.UserService;
import org.apache.thrift.TException;

import java.util.Random;
import java.util.UUID;

public class UserServiceImpl implements UserService.Iface {

    @Override
    public void sendMessage(User user) throws TException {

        System.out.println("server : " + user);
    }

    @Override
    public User receiveMessage() throws TException {

        return new User().setId(new Random().nextInt(100)).setName(UUID.randomUUID().toString()).setAddress("beijing")
                .setMessage(UUID.randomUUID().toString()).setTitle(UUID.randomUUID().toString());
    }
}
